function[x,output]=agent1solverho_2(index,ewsb,waut);
global P beta n m S state agent gammagrid  Y scalefactor lowerbound rho table  ewdev statedev12 statedev13 statedev23
i=index(1);
j=index(2);

f=utility(rho,gammagrid(:,1)*Y(j))+beta*ewsb(:,j,1)-waut(j,1);
gammarfun=interp1(f,gammagrid(:,4),0);
x(1)=1/(1+gammarfun)*Y(j);
wint(1)=interp1(gammagrid(:,4),ewsb(:,j,1),gammarfun);
wint(2)=interp1(gammagrid(:,4),ewsb(:,j,2),gammarfun);

output(1)=utility(rho,x(1))+beta*wint(1);
output(2)=utility(rho,Y(j)-x(1))+beta*wint(2);
end

